#ifndef GY_POPUPMENU_H
#define GY_POPUPMENU_H

#include <QWidget>
#include <QTreeWidgetItem>
#include <QFileInfoList>
#include "GY_DiagramScene.h"
#include "GY_ControlLibrary_global.h"
namespace Ui {
class GY_PopupMenu;
}
/**
 * @brief 蓝图右键菜单类
 * 读取./python目录下的所有.py文件创建菜单Function子项
 */
class GY_CONTROLLIBRARY_EXPORT GY_PopupMenu : public QWidget
{
    Q_OBJECT

public:
    explicit GY_PopupMenu(QWidget *parent = nullptr);
    ~GY_PopupMenu();
    static QFileInfoList FindAllFiles(const QString & dir, const QString & suffix);  //遍历文件夹下所有文件
    static QStringList getPackages();  //获取python包
    const QString findItemJsonStr(const QString itemName);  //查找图元的json数据
signals:
    void InsertItem(QString,GY_DiagramScene::Mode=GY_DiagramScene::InsertItem);
private slots:
    void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);

    void on_lineEdit_textChanged(const QString &arg1);

private:
    Ui::GY_PopupMenu *ui;
    QStringList packages;  //python包
};

#endif // GY_POPUPMENU_H
